package com.zy.datareceiver.binsess.warning.dao.impl;

import com.zy.datareceiver.binsess.status.mapper.SendInfoMapper;
import com.zy.datareceiver.binsess.warning.dao.WarningDataDao;
import com.zy.datareceiver.binsess.warning.entity.WarningData;
import com.zy.datareceiver.binsess.warning.mapper.WarningDataMapper;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
@CacheConfig(cacheNames = "warningDat")
public class WarningDataDaoImpl implements WarningDataDao {

    @Resource
    private WarningDataMapper warningDataMapper;
    @Resource
    private SendInfoMapper sendInfoMapper;

    @Cacheable(cacheNames = "selectNearData")
    @Override
    public List<WarningData> selectNearData(Integer pointId, Date startTime, Date endTime) {
        return warningDataMapper.selectNearData(pointId,startTime,endTime);
    }

    @Cacheable(cacheNames = "selectCount")
    @Override
    public Integer selectCount(WarningData warningData) {
        return warningDataMapper.selectCount(warningData);
    }

    @Cacheable(cacheNames = "emailSum")
    @Override
    public int selectEmailSum() {
        return sendInfoMapper.selectEmailSum();
    }

    @Cacheable(cacheNames = "phoneSum")
    @Override
    public int selectPhoneSum() {
        return sendInfoMapper.selectPhoneSum();
    }
}
